<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      p {
        height: 300px;
        border: solid;
        font-size: 4rem;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    </style>
  </head>
  <body style="overflow: hidden">
    <p>hello p1</p>
    <p>hello p2</p>
    <p>hello p3</p>
    <p>hello p4</p>
    <p>hello p5</p>
    <p>hello p6</p>
    <p>hello p7</p>
    <p>hello p8</p>
    <p>hello p9</p>
    <script>
      const ps = document.querySelectorAll("p");
      // 任意元素对象相对于窗口的位置信息
      console.log(ps[2].getBoundingClientRect());
      console.log(ps[7].getBoundingClientRect());
      // 根据窗口坐标，获取对应坐标下的元素对象
      console.log(document.elementFromPoint(400, 500).innerHTML);
    </script>
  </body>
</html>
